package com.whl.sm.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.whl.sm.model.parking.ParkingBill;
import com.whl.sm.model.parking.ParkingLots;
import com.whl.sm.model.parking.ParkingRecord;
import lombok.Data;

import java.util.Date;

@Data
public class ParkingBillVo {

    public ParkingBillVo(ParkingBill parkingBill, ParkingRecord parkingRecord, ParkingLots parkingLots){
        if (parkingBill != null){
            this.id = parkingBill.getId();
            this.payer = parkingBill.getPayer();
            this.paymentStatus = parkingBill.getPaymentStatus();
            this.paymentTime = parkingBill.getPaymentTime();
            this.billPrice=parkingBill.getBillPrice();
            this.visible = parkingBill.getVisible();
        }
        if (parkingRecord != null){
            this.enterTime = parkingRecord.getEnterTime();
            this.leaveTime = parkingRecord.getLeaveTime();
            this.licensePlate = parkingRecord.getLicensePlate();
        }
        if (parkingLots != null){
            this.parkingLotsId = parkingLots.getId();
            this.parkingCode = parkingLots.getParkingCode();
            this.parkingName = parkingLots.getParkingName();
        }
    }

    /**
     * 停车账单id
     * */
    private  String id;

    /**
     * 车牌号
     */
    private String licensePlate;


    /**
     * 停车场id
     * */
    private String parkingLotsId;

    /**
     * 停车场编号
     */
    private String parkingCode;

    /**
     * 停车场名称
     */
    private String parkingName;

    /**
     * 账单金额
     */
    private Double billPrice;

    /**
     * 离场时间
     */
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date enterTime;

    /**
     * 离场时间
     */
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date leaveTime;

    /**
     * 支付状态1:已支付 0:未支付
     */
    private Integer paymentStatus;

    /**
     * 支付者
     */
    private String payer;

    /**
     * 支付时间
     */
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date paymentTime;

    /**
     * 有效值1:有效 0:无效
     */
    private Integer visible;
}
